home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
ada
/
c01oop.zip
/
CPPWKBK
/
CPPV5-1.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-25
|
1KB
|
53 lines
#define HEADER "C++ Problem 5.1 by Rick Conn using Borland C++"
#include <stdio.h>
class wheel {
int wheel_diameter;
public:
wheel (int diameter);
void print(void);
};
class vehicle {
int horse_power;
wheel lfront, rfront, lrear, rrear;
public:
vehicle (int hp,
int diameter_of_each_wheel);
void print(void);
};
wheel::wheel (int diameter) { wheel_diameter = diameter; }
void wheel::print(void) {
printf("Wheel diameter = %d\n", wheel_diameter);
}
vehicle::vehicle (int hp,
int diameter_of_each_wheel) :
horse_power(hp),
lfront(diameter_of_each_wheel),
rfront(diameter_of_each_wheel),
lrear(diameter_of_each_wheel),
rrear(diameter_of_each_wheel)
{
// nothing else to be done
}
void vehicle::print(void) {
printf("Horse Power = %d\n", horse_power);
lfront.print();
rfront.print();
lrear.print();
rrear.print();
}
void main(void)
{
printf("%s\n", HEADER);
vehicle v (190, 32);
v.print();
}